package com.hzhc.controller.yworder;

import com.hzhc.common.BaseController;
import com.hzhc.dto.UserDto;
import com.hzhc.service.YwOrderCntrAuditService;
import com.hzhc.utils.ResultUtil;
import com.hzhc.utils.TokenUtil;
import com.hzhc.vo.YwOrderCntrAuditVo;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

/**
 * <p>
 * 箱修改申请 前端控制器
 * </p>
 *
 * @author 功不唐捐
 * @since 2024-08-30
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/cntrAudit")
public class YwOrderCntrAuditController extends BaseController {
    private final YwOrderCntrAuditService ywOrderCntrAuditService;

    /**
     * 新增箱申请
     */
    @PostMapping("/addCntrAuditRet")
    public ResultUtil<T> addCntrAuditRet(@RequestBody YwOrderCntrAuditVo vo, HttpServletRequest request) {
        UserDto user = TokenUtil.getUser(request);
        vo.setUserId(user.getId());
        vo.setCreateTime(LocalDateTime.now());
        return ywOrderCntrAuditService.addCntrAuditRet(vo);
    }


}
